
	void drawMap()
	{
		cGame_g.setColor(MENUS.MAIN_MENU_BACKGROUND_COLOR);
		cGame_g.fillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);
		cGame_g.setColor(INGAME.VIEWPORT_BACKGROUND_COLOR);
		cGame_g.fillRect(INGAME.VIEWPORT_X, INGAME.VIEWPORT_Y, INGAME.VIEWPORT_W, INGAME.VIEWPORT_H);
		#ifndef WRAP_DRAWREGION
		cGame_g.drawRegion(boardImg, cameraX - INGAME.VIEWPORT_X, cameraY - INGAME.VIEWPORT_Y, INGAME.VIEWPORT_W, INGAME.VIEWPORT_H, 0, INGAME.VIEWPORT_X, INGAME.VIEWPORT_Y, 0);
		#else
		drawRegion(boardImg, cameraX - INGAME.VIEWPORT_X, cameraY - INGAME.VIEWPORT_Y, INGAME.VIEWPORT_W, INGAME.VIEWPORT_H, 0, INGAME.VIEWPORT_X, INGAME.VIEWPORT_Y, 0);
		#endif
		
		cGame_g.setClip(INGAME.VIEWPORT_X, INGAME.VIEWPORT_Y, INGAME.VIEWPORT_W, INGAME.VIEWPORT_H);
		drawArmies();
		drawCursor(xMapToScreen(cursorX), yMapToScreen(cursorY));
		cGame_g.setClip(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
		drawCountryInfo();
	}
	
	public void drawArmies()
	{
		for(int countryId = 0; countryId < COUNTRY_INFO.TOTAL_COUNTRIES; countryId++)
		{
			if(countryArmyInScreen(countryId))
			{
				int armyX = xMapToScreen(tegCountries[countryId].collisionRect[cCountry.RECT_X]) + tegCountries[countryId].collisionRect[cCountry.RECT_W] / 2;
				int armyY = yMapToScreen(tegCountries[countryId].collisionRect[cCountry.RECT_Y]) + tegCountries[countryId].collisionRect[cCountry.RECT_H] / 2;
				cGame_g.setColor(INGAME.TOKEN_BORDER_COLOR);
				cGame_g.fillArc(armyX - (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH) / 2, armyY - (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH) / 2, (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH), (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH), 0, 360);
				if(!(cCountry.selectedCountry == countryId || cCountry.defendingCountry == countryId))
					cGame_g.setColor(tegPlayers[tegCountries[countryId].owner].color);
				else
					cGame_g.setColor(tegPlayers[tegCountries[countryId].owner].color + 0x444444);
				cGame_g.fillArc(armyX - INGAME.TOKEN_DIAMETER / 2, armyY - INGAME.TOKEN_DIAMETER / 2, INGAME.TOKEN_DIAMETER, INGAME.TOKEN_DIAMETER, 0, 360);
				font.setColor(INGAME.TOKEN_TEXT_COLOR);
				font.drawString("" + tegCountries[countryId].armies, armyX, armyY, DSmallFont.HCENTER | DSmallFont.VCENTER);
			}
			
			if(!regrouping)
				tegCountries[countryId].regroupableArmies = tegCountries[countryId].armies - 1;
			
			#ifdef SHOW_COUNTRIES_RECTS
			cGame_g.setColor(0x00FF00);
			cGame_g.drawRect(xMapToScreen(tegCountries[countryId].collisionRect[cCountry.RECT_X]), yMapToScreen(tegCountries[countryId].collisionRect[cCountry.RECT_Y]), tegCountries[countryId].collisionRect[cCountry.RECT_W], tegCountries[countryId].collisionRect[cCountry.RECT_H]);
			#endif
		}
	}
	
	public void drawCountryInfo()
	{
		for(int i = 0; i < COUNTRY_INFO.TOTAL_COUNTRIES; i++)
		{
			if(cursorOverCountry(i))
			{
				font.setPixelSize(1);
				font.setColor(INGAME.HUD_TEXT_COLOR);
				#if SCREEN_WIDTH!=128
				font.drawString(TEXT.INGAME_HUD_COUNTRY + tegCountries[i].name, INGAME.HUD_COUNTRY_X, INGAME.HUD_COUNTRY_Y, DSmallFont.TOP | DSmallFont.HCENTER);
				#else
				int w = font.getStringWidth(tegCountries[i].name) + font.pixelSize * 2;
				int h = font.getFontHeight() + font.pixelSize * 4;
				int x = xMapToScreen(cursorX) - w / 2;
				int y = yMapToScreen(cursorY) - h - font.pixelSize;
				if(y - h <= INGAME.VIEWPORT_Y)
				{
					y += h + SPRITES.CURSOR_MODULE_H;
				}
				if(x < 0)
				{
					x += w / 2;
				}
				if(x + w >= SCREEN_WIDTH)
				{
					x -= w / 2;
				}
				
					#ifdef USE_DRAWRGB
					drawAlphaRect(cGame_g, x, y, w, h, MENUS.MAIN_MENU_BACKGROUND_COLOR, MENUS.MAIN_MENU_ALPHA_LEVEL);
					#else
					cGame_g.setColor(MENUS.MAIN_MENU_BACKGROUND_COLOR);
					cGame_g.fillRect(x, y, w, h);
					#endif
				cGame_g.setColor(MENUS.MAIN_MENU_FOREGROUND_COLOR);
				cGame_g.drawRect(x, y, w, h);
				font.drawString(tegCountries[i].name, x + font.pixelSize * 2, y + font.pixelSize * 2, DSmallFont.TOP | DSmallFont.LEFT);
				#endif
				font.drawString(TEXT.INGAME_HUD_ARMIES + tegCountries[i].armies, INGAME.HUD_ARMIES_X, INGAME.HUD_ARMIES_Y, DSmallFont.TOP | DSmallFont.RIGHT);
				font.drawString(TEXT.INGAME_HUD_OWNER, INGAME.HUD_OWNER_X, INGAME.HUD_OWNER_Y, DSmallFont.TOP | DSmallFont.LEFT);
				font.setColor(tegPlayers[tegCountries[i].owner].color);
				font.drawString(tegPlayers[tegCountries[i].owner].name, INGAME.HUD_OWNER_X + font.getStringWidth(TEXT.INGAME_HUD_OWNER) + font.getFontWidth(), INGAME.HUD_OWNER_Y, DSmallFont.TOP | DSmallFont.LEFT);
				break;
			}
			
			if(i == COUNTRY_INFO.TOTAL_COUNTRIES - 1)
			{
				font.setPixelSize(1);
				font.setColor(INGAME.HUD_TEXT_COLOR);
				font.drawString(TEXT.INGAME_HUD_GET_HELP, INGAME.HUD_TURN_X, INGAME.HUD_OWNER_Y, DSmallFont.TOP | DSmallFont.LEFT);
			}
		}
		font.setPixelSize(1);
		font.setColor(INGAME.HUD_TEXT_COLOR);
		font.drawString(TEXT.INGAME_HUD_TURN, INGAME.HUD_TURN_X, INGAME.HUD_TURN_Y, DSmallFont.TOP | DSmallFont.LEFT);
		font.setColor(tegPlayers[cPlayer.turn].color);
		font.drawString(tegPlayers[cPlayer.turn].name, INGAME.HUD_TURN_X + font.getStringWidth(TEXT.INGAME_HUD_TURN) + font.getFontWidth(), INGAME.HUD_TURN_Y, DSmallFont.TOP | DSmallFont.LEFT);
		font.setPixelSize(2);
	}
	
	public boolean countryArmyInScreen(int countryId)
	{
		return ((tegCountries[countryId].collisionRect[cCountry.RECT_X] + tegCountries[countryId].collisionRect[cCountry.RECT_W] / 2 + (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH) / 2 > cameraX && tegCountries[countryId].collisionRect[cCountry.RECT_X] + tegCountries[countryId].collisionRect[cCountry.RECT_W] / 2 - (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH) / 2 < cameraX + INGAME.VIEWPORT_W) && (tegCountries[countryId].collisionRect[cCountry.RECT_Y] + tegCountries[countryId].collisionRect[cCountry.RECT_H] / 2 + (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH) / 2 > cameraY && tegCountries[countryId].collisionRect[cCountry.RECT_Y] + tegCountries[countryId].collisionRect[cCountry.RECT_H] / 2 - (INGAME.TOKEN_DIAMETER + INGAME.TOKEN_BORDER_WIDTH) / 2 < cameraY + INGAME.VIEWPORT_H));
	}
	
	public int xMapToScreen(int x)
	{
		return INGAME.VIEWPORT_X + x - cameraX;
	}
	
	public int yMapToScreen(int y)
	{
		return INGAME.VIEWPORT_Y + y - cameraY;
	}